package com.example.controller;

import com.alibaba.fastjson.JSON;
import com.example.mapper.AlarmMapper;
import com.example.pojo.msgDevice;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @authorDuanyYingZhi
 * @create2022-01-18:52
 */
public class alarmbyMonitor {
    @Autowired
    private AlarmMapper alarmMapper;

    public  void  getalarminfor(String param){
        Map<String, Object> map = JSON.parseObject(param, HashMap.class);

        String systemBelong = (String)map.get("systemBelong");
        String subsystemBelong =(String) map.get("subsystemBelong");
        String floor = (String)map.get("floor");
        String environment =(String) map.get("environment");
        List<msgDevice> selectby=new ArrayList<>();
        if (subsystemBelong!=null){
            selectby = alarmMapper.selectby(systemBelong, subsystemBelong, null, null);
        }else if (systemBelong!=null){
            selectby = alarmMapper.selectby(systemBelong,null,null,null);
        }
        else if (environment!=null){
            selectby =  alarmMapper.selectby(null,null,floor,null);
        }else if (floor!=null){
            selectby =  alarmMapper.selectby(null,null,null,environment);
        }


    }





}
